<template>
  <div>
    <el-tabs v-model="activeName" type="border-card" @tab-click="tabClick">
      <el-tab-pane label="项目信息" name="project">
        <keep-alive>
          <project @toIt="toIt" :switch="true" :status="status" ref="project"></project>
        </keep-alive>
      </el-tab-pane>
      <el-tab-pane label="资产信息" name="it" :disabled="itType">
        <it @toIndex="toIndex" ref="it" :switch="true"></it>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import Project from './project.vue';
import it from '../../components/it.vue';
export default {
  name: 'Unit',
  components: {
    Project, it
  },
  props: {

  },
  data () {
    return {
      activeName: 'project',
      true: true,
      false: false,
      status: '51',
      itType: true
    }
  },
  created () {
  },
  mounted () {
    this.init()
  },
  methods: {
    init () {
      this.itType = true
      this.activeName = 'project'
    },
    tabClick (tab) {
      if (tab.name === 'project') {
        this.$refs.project.init()
      } else if (tab.name === 'it') {
        this.$refs.it.init()
      }
    },
    toIt () {
      this.itType = false
      this.$refs.it.init()
      this.activeName = 'it'
    },
    toIndex () {
      this.$refs.project.init()
      this.activeName = 'project'
    },
  },
  computed: {

  },
}
</script>
<style lang="scss" scoped>
</style>
